#!/usr/bin/perl
#save_timeout.cgi

require './session-lib.pl';
&error_setup($text{'timeout_error'});
&ReadParse();

if ($in{'timeout'} !~ /^\d*$/)
{
	&nas_syslog("session", "naslog_warning", 36001, "Invalid session timeout interval.");
	&error($text{'invalid_interval'});
}

$in{'timeout'} = "" if ($in{'timeout'} == 0);
&lock_file($ENV{'MINISERV_CONFIG'});
&get_miniserv_config(\%miniserv);
$miniserv{'logouttime'} = ($in{'timeout'} ne "")?$in{'timeout'}:undef;
&put_miniserv_config(\%miniserv);
&unlock_file($ENV{'MINISERV_CONFIG'});
&restart_miniserv();
&nas_syslog("session", "naslog_info", 36000, "Change session timeout success!");
&redirect("");
